package cn.itsource.basic.controller;

import cn.itsource.basic.dto.LoginDto;
import cn.itsource.basic.util.AjaxResult;
import cn.itsource.user.mapper.LogininfoMapper;
import cn.itsource.user.service.ILogininfoService;
import cn.itsource.user.service.impl.LogininfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    ILogininfoService logininfoService;
    @PostMapping("/account")
    public AjaxResult accountLogin(@RequestBody LoginDto loginDto){
        return logininfoService.accountLogin(loginDto);
    }

    @PostMapping("/wechat/{code}")
    public AjaxResult wechatLogin(@PathVariable("code") String code){
        return logininfoService.wechatLogin(code);
    }

    @PostMapping("/wechat/binder")
    public AjaxResult wechatBinder(@RequestBody Map<String, String> map){
        return logininfoService.wechatBinder(map);
    }

}
